<template>
    <view class="content">
        <view class="box" v-if="list.pro_name">
            <view class="item">
                <view class="item-l">项目名称：</view>
                <view class="u-flex-1 u-flex">
                    <view class="u-flex-1">{{list.pro_name}}</view>
                    <view class="sta" v-if="list.enter_examine == 1">待审核</view>
                    <view class="sta2" v-if="list.enter_examine == 2">已通过</view>
                    <view class="sta" v-if="list.enter_examine == 3">无效</view>
                </view>
            </view>
            <view class="item">
                <view class="item-l">置业顾问：</view>
                <view class="u-flex-1">{{ list.broker_name }}</view>
            </view>
            <view class="item">
                <view class="item-l">绑定机构：</view>
                <view class="u-flex-1">{{ list.institution }}</view>
            </view>
            <view class="item">
                <view class="item-l">认购信息：</view>
                <view class="u-flex-1">{{ list.room_no }}-{{ list.area }}㎡</view>
            </view>
            <view class="item" v-if="list.buy_time">
                <view class="item-l">认购时间：</view>
                <view class="u-flex-1">{{ list.buy_time }}</view>
            </view>
            <view class="btns">
                <view class="ck-btn" @click="toPage">查看详情</view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                id: '',
                list: [], 
                role: '',
            };
        },
        onLoad(option) {
            this.id = option.id
            // 从个人中心 项目报备列表进入
            if (option.role) {
                this.role = option.role
            }
        },
        onShow() {
            this.getList()
        },
        methods: {
            toPage() {
                this.$cTo('/pages/kehu/details-2?id=' + this.list.id + '&role=' + this.role)
            },
            
            // 获取认购列表
            getList() {
            	this.$ajax('subscribe_for_list', {
            		user_token: this.$getSync('userToken'),
            		id: this.id,
            	}).then(ret => {
            		if (ret.success == 1000) {
                        this.list = ret.detail
            		} else {
            			this.$toast(ret.msg);
            		}
            	});
            },
        },
    };
</script>

<style lang="scss">
    .btns{
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
    .ck-btn{
        padding: 15rpx 25rpx;
        background-color: #f0f0f0;
        border-radius: 50rpx;
        font-size: 26rpx;
        line-height: 1;
    }
    page{
        background-color: #f5f5f5;
    }
    .content{
        padding: 20rpx;
    }
    .box{
        background-color: #fff;
        border-radius: 20rpx;
        margin-bottom: 20rpx;
        padding: 30rpx 25rpx 20rpx;
    }
    .sta{
        font-size: 28rpx;
        color: #fe6155;
        padding-left: 10rpx;
    }
    .sta2{
        font-size: 28rpx;
        color: #09ba07;
        padding-left: 10rpx;
    }
    .item{
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 10rpx;
        font-size: 24rpx;
    }
    .item-l{
        // width: 24.5vw;
    }
    
</style>
